package com.kkb.mybatis.framework.builder;

import com.kkb.mybatis.framework.config.Configuration;
import org.dom4j.Element;

import java.util.List;

/**
 *  专门解析映射文件
 */
public class XMLMapperBuilder {

    private Configuration configuration;

    public XMLMapperBuilder(Configuration configuration) {
        this.configuration = configuration;
    }

    public void parseMapper(Element element){
        String namespace = element.attributeValue("namespace");
        //以select为例
        List<Element> elements = element.elements("select");
        for (Element element1 : elements) {
            XMLStatementBuilder xmlStatementBuilder = new XMLStatementBuilder(configuration);
            xmlStatementBuilder.parseStatementElement(element1,namespace);
        }
    }
}
